<template>
    <div class="sonsosn1">
        <h3>孙子组件SonSonDemo1</h3>
        <p>我想用页面组件的数据</p>
        <div>cake2: {{ props.cake2 }}</div>
        <div>爷爷的和氏璧：{{ heshibi }}</div>
    </div>
</template>

<script setup lang='ts'>

import { inject, type Ref } from 'vue';
import { myInjectionKey } from './keys'

const props = defineProps<{
    cake2: string
}>()

const { heshibi } = inject(myInjectionKey) as {
    heshibi: Ref<string>
}


</script>

<style lang="scss" scoped>
.sonson1 {
    border: 2px solid deepskyblue;
    margin: 10px;
    padding: 10px;
}
</style>